package com.zzzzzz.oms.timeLimit;

import java.util.Date;
import javax.annotation.Resource;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zzzzzz.plugins.shiro.I;

@Service
public class TimeLimitService {
	
	@Resource
	public TimeLimitDao timeLimitDao;
	
	@Resource
	public Validator validator;
	
	// 增加、修改
	@Transactional
	public int save(TimeLimit timeLimit, I i) {
		timeLimit.setUpdDt(new Date());
		timeLimit.setUpdBy(i.getId());
		if (timeLimit.getId() == null) {
			timeLimit.setAddDt(new Date());
			timeLimit.setAddBy(i.getId());
			timeLimitDao.add(timeLimit);
		} else {
			timeLimitDao.updById(timeLimit);
		}

		return 1;
	}

	private static final Logger logger = LoggerFactory.getLogger(TimeLimit.class);
}
